package hot100.字母异位词分组;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

/**
 * @author llt
 * @date 2025/3/17
 */
public class Test {
    public List<List<String>> groupAnagrams(String[] strs) {
        return new ArrayList<>(Arrays.stream(strs).collect(Collectors.groupingBy(str -> {
            char[] arr = str.toCharArray();
            Arrays.sort(arr);
            return new String(arr);
        })).values());
    }
}
